package org.example.design.Flyweight.factory;

import cn.hutool.core.date.DateUtil;
import org.example.design.Flyweight.bean.Activity;

import java.util.HashMap;
import java.util.Map;

/**
 * @Classname ActivityFactory
 * @Description TODO
 * @Date 2020/11/5 2:38 下午
 * @Created by xiangjd
 */
public class ActivityFactory {
    static Map<Long, Activity> activityMap = new HashMap<Long, Activity>();

    public static Activity getActivity(Long id) {
        Activity activity = activityMap.get(id);
        if (null == activity) {
            activity = new Activity();
            activity.setId(1000L);
            activity.setName("基金投资实战");
            activity.setDesc("一本很牛逼的基金实战书籍，适合所有人");
            activity.setStartTime(DateUtil.date());
            activity.setEndTime(DateUtil.date());
            activityMap.put(id, activity);
        }
        return activity;
    }

}
